<template>
  <div>
    <div class="h60">
      <span class="exnum">{{ Num }}.{{ item.title }}</span>
      <span class="labels">
        <span v-if="item.isJt == '1'">机经</span>
        <span v-if="item.isJt !== '1'" style="background: #7cc3d6">练习题</span>
        <span
          style="background: #ff5e4e"
          v-if="item.labelStyle == 'wrong-color'"
          >错题</span
        >
        <span style="background: #13bfbf" v-if="item.isYc == '1'"
          >本周预测</span
        >
        
        <span style="background: #94d0f7">{{ item.titleNumber }}</span>
      </span>
    
    </div>
    <div class="player">
      <Audioplayer v-if="item.url" :url="item.url"></Audioplayer>
       <h1 v-else class="none_audio_tip">此题暂未上传录音</h1>
    </div>

    <div class="timu">
      <!-- 题目组件 -->
      <Incorrect
        ref="incorrect"
        v-for="(item, index) in content"
        :key="index"
        :content="item"
        @sendNum="getNum($event, item)"
      ></Incorrect>
      <div class="time">
        <span v-if="isDt">答题时间：{{ s_to_hs(answerTime) }}</span>
        <span v-else>准备时间：{{ s_to_hs(readyTime) }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import Incorrect from '../../../../practice/exercise/incorrect'
import listeningUtil from "@/utils/listeningUtil";
import Audioplayer from '../../player'
export default {
  props: ['item', 'Num'],
  mixins: [listeningUtil],
  components: {
    Audioplayer,
    Incorrect
  },
  data () {
    return {
      content: '',
      num: 0,
      answerTime: 0,
      isBgc: false,
      answer: [],
      flag:true
    }
  },
  created () {
    setInterval(this.countDownReady, 1000)
    this.content = this.item.content.split(' ')
  },
  methods: {
    getNum (e, item) {
      this.num += e
      // console.log(item);
      this.$emit('sendAnswer',item,this.flag)
    },
  },
}
</script>

<style lang="less" scoped>
.none_audio_tip{
  font-size: 1.25rem;
  color: #999;
  padding: 1.125rem;
}
.player{
  margin-bottom: 1rem;
  border: 1px dashed #ff5e4e;
  background-color: #fffafa;
}
.timu {
  width: 100%;
  background: #fff;
  box-sizing: border-box;
  padding: 0 2.5rem;
  box-sizing: border-box;
  font-size: 1.125rem;
  color: #666;
  line-height: 2rem;
  padding-bottom: 20px;
  .time {
    margin-top: 2rem;
  }
}
.h60 {
  height: 3.75rem;
  line-height: 3.75rem;
  padding-left: 1.25rem;
  box-sizing: border-box;
  background-color: #f7f7f7;
  display: flex;
  position: relative;
  margin-bottom: 1rem;
  .exnum {
    width: 45rem;
    font-size: 1rem;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .labels {
    display: flex;
    justify-content: flex-end;
    width: 21.25rem;
    span {
      height: 1.875rem;
      line-height: 1.875rem;
      padding: 0 0.375rem;
      box-sizing: border-box;
      background-color: #ff9b4f;
      border-radius: 0.1875rem;
      margin: 0.9375rem 0.46875rem;
      color: #fff;
      box-sizing: border-box;
    }
  }
}
</style>